package cn.tedu.sp04.order.feign;

import cn.tedu.sp01.pojo.User;
import cn.tedu.web.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class UserFeignClientFB implements UserFeignClient{

    @Override
    public JsonResult<User> getUser(Integer userId) {
        Double d=Math.random();
        log.info("d=Math.random()==="+d);
        if(d<0.4) {
            return JsonResult.ok(new User(userId, "缓存name......"+userId, "缓存pwd......"+userId));
        }
        return JsonResult.err("无法获取用户信息");
    }

    @Override
    public JsonResult addScore(Integer userId, Integer score) {
        return JsonResult.err("无法增加用户积分");
    }
}
